package TopSky.IOT.JUnit;

import static org.junit.Assert.*;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.Field;

import org.junit.Test;

import com.taobao.api.internal.mapping.ApiField;
import com.taobao.api.internal.mapping.ApiListField;

public class Models {

	@Test
	public void controldevice() {

		TopSky.IOT.Models.controldevice controldevice=new TopSky.IOT.Models.controldevice();
		Annotation[] fields = controldevice.getClass().getAnnotations();

		controldevice.getClass();
		fail("Not yet implemented");
	}
	
	public void getInfo(Class<?> clazz){
	        
	        String strFruitName=" 水果名称：";
	        String strFruitColor=" 水果颜色：";
	        String strFruitProvicer="供应商信息：";
	        
	        Field[] fields = clazz.getDeclaredFields();
	        
	        for(Field field :fields){
	            if(field.isAnnotationPresent(ApiField.class)){
	            	ApiField ApiField = (ApiField) field.getAnnotation(ApiField.class);
	                strFruitName=strFruitName+ApiField.value();
	                System.out.println(strFruitName);
	            }
	            else if(field.isAnnotationPresent(ApiListField.class)){
	            	ApiListField ApiListField= (ApiListField) field.getAnnotation(ApiListField.class);
	                strFruitColor=strFruitColor+ApiListField.value().toString();
	                System.out.println(strFruitColor);
	            }
	            
	        }
	}
}

/*====================================
 水果名称：Apple
 水果颜色：RED
 供应商编号：1 供应商名称：陕西红富士集团 供应商地址：陕西省西安市延安路89号红富士大厦*/